From 835b7198881ccfe6e7beed9f7392dcb60c9c0ab0 Mon Sep 17 00:00:00 2001 From: Harel Mazor Date: Wed, 25 Jan 2017 23:49:57 +0200 Subject: [PATCH] Updated documentation, added geojson.geojson test file, updated vecs array according to code review. --- geojson.cc | 6 +++++- reference/track/geojson.geojson | 1 + xmldoc/formats/geojson.xml | 9 ++++----- 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 reference/track/geojson.geojson diff --git a/geojson.cc b/geojson.cc index 00bb41bb7..20c05ea93 100644 --- a/geojson.cc +++ b/geojson.cc @@ -313,7 +313,11 @@ geojson_write(void) { ff_vecs_t geojson_vecs = { ff_type_file, - { (ff_cap)(/*ff_cap_read | */ff_cap_write), ff_cap_write, ff_cap_none }, + { + (ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */, + (ff_cap)(ff_cap_read | ff_cap_write) /* tracks */, + (ff_cap)(ff_cap_read | ff_cap_write) /* routes */, + }, geojson_rd_init, geojson_wr_init, geojson_rd_deinit, diff --git a/reference/track/geojson.geojson b/reference/track/geojson.geojson new file mode 100644 index 000000000..83862b5ab --- /dev/null +++ b/reference/track/geojson.geojson @@ -0,0 +1 @@ +{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[1.0,1.0]},"properties":{}},{"type":"Feature","geometry":{"type":"MultiPoint","coordinates":[[2.0,2.0]]},"properties":{}},{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[3.0,3.0],[4.0,4.0],[5.0,5.0],[3.0,3.0]]]},"properties":{}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[6.0,6.0],[7.0,7.0]]},"properties":{}},{"type":"Feature","geometry":{"type":"MultiPolygon","coordinates":[[[[8.0,8.0],[9.0,9.0],[10.0,10.0],[8.0,8.0]]]]},"properties":{}},{"type":"Feature","geometry":{"type":"MultiLineString","coordinates":[[[11.0,11.0],[12.0,12.0]],[[12.0,12.0],[13.0,13.0]],[[14.0,14.0],[15.0,15.0]]]},"properties":{}}]} \ No newline at end of file diff --git a/xmldoc/formats/geojson.xml b/xmldoc/formats/geojson.xml index ae1eb44b1..f4e913966 100644 --- a/xmldoc/formats/geojson.xml +++ b/xmldoc/formats/geojson.xml @@ -10,15 +10,14 @@ that GPSBabel supports well to something like Leaflet, you should not expect high fidelity transfers through this format. -Initially, only write support for waypoints and tracks is available. -Waypoints are converted to a FeatureCollection of Points. +Waypoints are mapped to a FeatureCollection of Points. The properties for name and description are written, where available. Tracks are converted to a LineString. +MultiPoint are converted to Waypoints. +LineString, Polygon and MultiPolygon are converted to routes. +MultiLineString are conveted to tracks. -Potential future work includes the ability to read Point Features and/or -LineStrings as these would map into our concept of waypoints and -routes/tracks. The potentially nested/recursive nature of GeoJSON in general would be an awkward implementation. -- 2.30.2